home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
TPUG - Toronto PET Users Group
/
TPUG Users Group CD
/
TPUG Users Group CD.iso
/
CRS
/
crs54.d81
/
sgtool12.arc
/
SGCTOOLS.DOC
< prev
next >
Wrap
Text File
|
1993-08-10
|
9KB
|
233 lines
___________________________________________________________________
SG C Tools 1.2
(C) 1993 Steve Goldsmith
All Rights Reserved
___________________________________________________________________
NOTICE
THIS IS NOT FREE SOFTWARE! If you paid a public domain vendor or
communications service for this product, you paid for the service
of copying or transferring the product, and not for the product
itself. I guarantee you that nothing ever gets to the originator
of this product from such a sale. You may evaluate this product,
but if you make use of it, you must register your copy.
I offer several incentives for you to register. First of all,
you receive the most up-to-date copy that I have which is updated
on a regular basis. Unregistered releases do not include Assembler
source files or bonus modules and programs. Support via GEnie,
Internet (via GEnie), US Mail or phone from the author.
REGISTRATION INFORMATION
The non-commercial registration fee for SG C Tools 1.2 is $10.00
plus $3.00 for shipping in US funds.
Send a check or money order for the appropriate amount to:
Steve Goldsmith
2805 Jamaica Street
Sarasota, FL 34231
Please indicate what product you are ordering and if you have a
requirement for 3.5" media. I normally ship 5.25" Commodore GCR
format diskettes, but will furnish 3.5" media upon request.
Customers outside of the United States and Canada should include an
extra $5.00 for airmail.
If you are a registered user of this product and desire an update,
please contact me for upgrade prices.
DISTRIBUTION NOTICE
This is "user-supported" software. You are hereby granted a
license by Steve Goldsmith to distribute this evaluation copy of SG
C Tools and its documentation, subject to the following conditions:
1. SG C Tools may be distributed freely without charge in
evaluation form only.
2. SG C Tools may not be sold, licensed, or a fee charged for its
use. If a fee is charged in connection with SG C Tools, it
must cover the cost of copying or dissemination only. Such
charges must be clearly identified as such by the originating
party. Under no circumstances may the purchaser be given the
impression that he is buying SG C Tools itself.
3. SG C Tools must be presented as a complete unit, including
this documentation. Neither SG C Tools nor its documentation
may be amended or altered in any way.
4. By granting you the right to distribute the evaluation form of
SG C Tools, you do not become the owner of SG C Tools in any
form. Any other use, distribution or representation of SG C
Tools is expressly forbidden without the written consent of
Steve Goldsmith.
Commodore 128 is a trademark of Commodore Business Machines. CP/M
and CP/M 3.0 are trademarks of Digital Research. MS-DOS is a
trademark of Microsoft. IBM PC, PC-XT and PC-AT are trademarks
of International Business Machines.
OVERVIEW
SG C Tools provides a set of high level ANSI C modules to unlock
the power of the C128 running CP/M. With a little modification it
should compile with a native mode ANSI C compiler too! All
functions are included in a library to make compiling your programs
fast and easy. Example programs are included to get you started!
REQUIREMENTS
* A C128 or C128D running CP/M 3.0 or a IBM PC running a CP/M
emulator and DOS to CP/M file transfer software.
* At least one 1581, two 1571s, large RAM disk or hard drive to
compile on a C128.
* 80 column monitor for VDC specific routines.
* ANSI C programming experience
VERSION INFORMATION
1.0
First version came with basic VDC I/O, fills, copies, fast string
writes and basic screen controls.
1.1
Added up and down scrolls of any region, fast pop up windows and
buffered VDC I/O. All VDC functions are now in a library called
LIBC128.LIB. Use C FILENAME.C -LC128 to compile instead of C
FILENAME.C VDC.OBJ. Low level VDC I/O functions invdc() and
outvdc() are now in a external Assembler file VDCIO.AS. This
increased the over all speed a great deal!
I used Simeon Cran's MYZ80 Z80 emulator running ZP/M 3 under
Windows 3.1 to compile this version. Sydex's 22DISK was used to
transfer files from DOS to a Epson QX-10 format disk. This allowed
me to run code on a C128 without having to run a C128 native mode
file transfer program like BBR. You could also use a C128 CP/M
program that reads DOS disks for about the same result.
1.2
The modules in LIBC128.LIB are broken down to their smallest
components to make sure that no dead code is linked in. Some
modules still have more than one function if there are
dependencies.
Added VDC registers 20 and 21 missing from 1.1 savevdc().
restorevdc() didn't restore these registers, so if you modified
them in a program they were not restored. Also, savevdc() no
longer initializes the global 'vdc' variables. You have to call
mapvdc() whenever you want to initialize them to the current VDC
configuration.
mapvdc() sets vdcCharMem incorrectly for values other then 2000h,
6000h, A000h and E000h. See CHSET.C for an example of this
problem. In the next release I may remove the code that sets
vdcCharMem and have the main programs set it manually. If you can
figure out why VDC register 28 acts this way let me know!
Added functions to set VDC to 64K mode, turn attributes on/off, set
80 X 50 interlaced text mode, set bit map mode, set pixels, draw
lines, draw circle and print strings in bit map mode! See
VDCDEMO.C for an example of using the new functions. circlevdc()
doesn't draw true circles due to the aspect ratio of 640 X 200 bit
map mode. I did some correction by reducing Y axis plots by 50%.
A general ellipse algorithm would be better. It involves a new
formula in terms of the P parameter (see VDCCIR.C). If you come up
with one I'll give you a free registered copy! I really need to
get some graphics books instead of hacking this stuff!
COMPILING SOURCE CODE WITH HI-TECH C 3.09
First you will need to have a copy of HI-TECH C 3.09 (CP/M-80).
You can download the following Freeware files from GEnie's CP/M RT
(M685;3) or other source:
8149 LIBSRC.LZH X BRIAN-CPM 930616 80384 39
3
Desc: Source Code to Hitech C library
8148 Z80V309.LZH X BRIAN-CPM 930616 194304 51
3
Desc: Hitech C Compiler for CP/M
8147 Z80DOC.LZH X BRIAN-CPM 930616 89088 55
3
Desc: Documentation for Hitech C compiler
You should look over HI-TECH C's manual and compile a simple "hello
world" program before proceeding. I installed all the compiler
related files on my 1581. My source and header files are on a
1571. You could get away with two 1571s, but a RAM disk or hard
drive would be better. You could also use a CP/M-80 emulator on
the IBM PC and copy compiled files to C128 for testing.
To compile sample programs use:
C -O -X FILENAME.C -LC128
PROGRAMMING CONSIDERATIONS
SG C Tools is getting complex enough to explain a few things. The
VDC should be configured to its default CP/M 3.0 settings at the
start and end of each program.
Display memory 0000h
Attribute memory 0800h
Character definitions 2000h
This includes restoring character definitions if you use memory at
2000h for something else like a bit map. Setting the VDC to 64K
mode wipes out memory used in 16K mode, so be sure to save the
character definitions to a memory buffer or file before using 64K
mode. The VDC remains in 64K mode until you do a cold boot or warm
boot with the C128's reset button.
Most of the VDC functions do not check parameters for range
violations. Range checking should be preformed at the application
level. There are times when you may want to write to a off screen
memory location. For this reason there is no need to waste time
and code doing range checks. Just be aware of the implications.
A renegade program may accidentally wipe out character definitions
or other important memory regions forcing you to reboot.
Basically, just return to CP/M the way it was before your program
ran. See VDCDEMO.C for a complete example of setting various VDC
modes and exiting back to CP/M correctly.
The source for LIBC128.LIB is provided in LIBC128.ARC. Z80
Assembler source is not provided with unregistered copies. Only
.OBJ files are provided. I have included the C equivalents of the
functions though. Try replacing the Assembler .OBJs with their C
counterparts and you will see why it is worth it to register! For
example, using VDCIO.C and VDCBMPIX.C in VDCDEMO.C caused the line
example to take 26 seconds compared to 8 seconds with Assembler!
At least I was nice enough to include the fast .OBJs for you to
use!
HOW TO CONTACT ME
Please report any support questions, problems, suggestions, etc. to
me via GEnie S.GOLDSMITH2, Internet S.GOLDSMITH2@GENIE.GEIS.COM,
voice phone (813) 925-1064 or US Mail to:
Steve Goldsmith
2805 Jamaica Street
Sarasota, FL 34231
USA